use markdown_parser::parse;

#[test]
fn test_markdown_underscore() {
    let input = "__4[s]4__\n";
    let (res, errs) = parse(input);
    if let Some(errs) = errs {
        panic!("{}", errs)
    }
    if let Some(res) = res {
        // println!("{:#?}", res);
        for ele in res.iter() {
            assert_eq!(ele.to_string().trim(), "<p><ins>4[s]4</ins></p>")
        }
    } else {
        panic!("下滑线文本解析错误");
    }
}
#[test]
fn test_markdown_underscore2() {
    let input = "__4[s]4\n";
    let (res, errs) = parse(input);
    if let Some(errs) = errs {
        panic!("{}", errs)
    }
    if let Some(res) = res {
        for ele in res.iter() {
            assert_eq!(ele.to_string().trim(), "<p>__4[s]4</p>")
        }
    } else {
        panic!("下滑线文本解析错误");
    }
}

#[test]
fn test_markdown_underscore3() {
    let input = "__\n";
    let (res, errs) = parse(input);
    if let Some(errs) = errs {
        panic!("{}", errs)
    }
    if let Some(res) = res {
        for ele in res.iter().take(1) {
            assert_eq!(ele.to_string().trim(), "<p>__</p>")
        }
    } else {
        panic!("下滑线文本解析错误");
    }
}
